<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body {
            height: 2000px;
        }
        
        #outer {
            width: 300px;
            height: 300px;
            background: red;
        }
        
        #inner {
            width: 200px;
            height: 200px;
            background: yellow;
            position: absolute;
        }
    </style>
</head>

<body>
    <!-- <div id="outer"> -->
    <div id="inner"></div>
    <!-- </div> -->
    <script>
        // outer.onclick = function() {
        //     alert("outer")
        // }
        // inner.onclick = function(event) {
        //     // alert("inner")
        //     // event.cancelBubble = true;
        //     // event.stopPropagation();
        //     console.log(event)
        //     console.log(event.clientX, event.clientY)
        // }

        document.onmousemove = function(event) {
            // event = event || window.event;
            // let left = event.clientX;
            // let top = event.clientY;

            // let st = document.body.scrollTop || document.documentElement.scrollTop;
            // inner.style.left = left + "px";
            // inner.style.top = st + top + "px";



            // let left = event.pageX;
            // let top = event.pageY;

            // inner.style.left = left + "px";
            // inner.style.top = top + "px";
        }
    </script>
</body>

</html>